<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-cache">
		<meta http-equiv="Expires" content="0">
		<meta name="description" itemprop="description" content="">
		<meta itemprop="name" content="">
	</head>
	<style type="text/css">
		
	</style>

	<body>
		
		<div id="content" v-cloak>
			<div class="inputInformation">
				<div class="information">
					<div class="payBt" v-on:tap="rise()"></div>
				</div>
				
			</div>
		</div>
		<script src="../../public/core/js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../public/plugins/vue-resource.js" type="text/javascript" charset="utf-8"></script>
	</body>


	<script type="text/javascript">
		var invitation = new Vue({
			el: '#content',
			data: {
				lotNumber: 0, 
				newPhone: '',
				phoneCode: '',
				blackPhone:''
			},
			mounted: function mounted() {
			
				// 只需初始化一次
				var _this = this;
				
				window['register'] = function() {//告诉ios调用H5的哪个方法(register) 
					_this.register()
				}

			},
			filters: {
			
			},
			methods: {
				//js获取地址栏参数
				GetQueryString: function GetQueryString(name) { //用JS获取地址栏参数的方法
					var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
					var r = window.location.search.substr(1).match(reg);
					if(r != null) return unescape(r[2]);
					return null;
				},
				register:function(str){//定义一个方法接收ios的返回值 该方法名register要和window['register'] = function() {_this.register()}里一样
					if(str){
						alert(1)
					}else{
						alert(2)
					}
				},
                anzhuo:function(str){//安卓没有太多要求，也不需要window['']=function()声明，直接随便写一个方法接收安卓方传过来的状态就行
                    if(str){
						alert(1)
					}else{
						alert(2)
					}
                }
				rise: function() {
					var u = navigator.userAgent,
					var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
					var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
						//调取ios的方法
						var obj = {
							phone:this.newPhone,
							verificationCode:this.phoneCode,
							lotNumber:this.lotNumber,
							isBlackPhone:this.blackPhone
						}
						if(isAndroid){
							var str = this.newPhone+","+this.phoneCode+","+this.lotNumber+","+this.blackPhone;
							console.log(str)
							billactivity.newPackage(str);
						}else{
							window.webkit.messageHandlers.newPackage.postMessage(obj);//接收ios的方法并把参数传给ios
						}
						
					}
					

					
				},
				
				
				//倒计时
				setTimeR: function setTimeR() {
					var i = 60;
					var self = this
					var mytime = setInterval(function() {
						self.countdown = '剩' + i + '秒'
						if(i == -1) {
							clearInterval(mytime);
							self.countdown = '验证码'
							self.showcode = 0;
							i = 60
						}
						i--;
					}, 1000)
				},
				
				

			}
		})
	</script>
	

</html>